package com.ruoyi.service.impl;


import com.github.pagehelper.PageHelper;


import com.ruoyi.mapper.MaterielThreeMapper;
import com.ruoyi.domain.MaterielThree;
import com.ruoyi.service.MaterielThreeService;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Service
public class MaterielThreeServiceImpl implements MaterielThreeService {
    @Autowired
    MaterielThreeMapper materielThreeMapper;


    @Override
    public Map<String, Object> allMaterielThree(int page, int limit) {
        List<MaterielThree> materielThrees = materielThreeMapper.selectAll();
        PageHelper.startPage(page,limit);
        Map<String, Object> result = new HashMap<>();
        result.put("total",materielThrees.size());
        result.put("data", materielThreeMapper.selectAll());
        return result;
    }

    @Override
    public Map<String, Object> selectMaterielThree(int page, int limit, String itemCode, String lotCode, String supplierName, String docDate) {
        List<MaterielThree> materielThrees = materielThreeMapper.selectMaterielThree(itemCode,lotCode,supplierName,docDate);
        PageHelper.startPage(page,limit);
        Map<String, Object> result = new HashMap<>();
        result.put("total", materielThrees.size());
        result.put("data", materielThreeMapper.selectMaterielThree(itemCode,lotCode,supplierName,docDate));
        return result;
    }
}
